using UnityEngine;

public struct MHitBall
{
	public Vector3 ballPosition;

	public Vector3 landingPosition;

	public float heightAboveNet;

	public float timeToLand;

	public float spinx;

	public float spiny;

	public bool isServe;

	public bool isBallInGame;

	public bool useNormalTime;

	public int pingTimeMs;

	public float airResistance;

	public float rebound;

	public float racketTimeScale;

	public void SetFromHitBallParams(HitBallParams p)
	{
		ballPosition = p.ballPosition;
		landingPosition = p.landingPosition;
		heightAboveNet = p.heightAboveNet;
		timeToLand = p.timeToLand;
		spinx = p.spinx;
		spiny = p.spiny;
		isServe = p.isServe;
		useNormalTime = p.useNormalTime;
		pingTimeMs = PhotonNetwork.GetPing();
		airResistance = p.airResistance;
		rebound = p.rebound;
		racketTimeScale = p.racketTimeScale;
	}

	public void ConvertFromRemoteToLocalSpace()
	{
		ballPosition = MultiplayerMatchController.RemoteToLocalPos(ballPosition);
		landingPosition = MultiplayerMatchController.RemoteToLocalPos(landingPosition);
	}

	public void Send(GGNetwork network)
	{
		network.BeginWrite(7);
		network.AddVector3(ballPosition);
		network.AddVector3(landingPosition);
		network.AddFloat(heightAboveNet);
		network.AddFloat(timeToLand);
		network.AddFloat(spinx);
		network.AddFloat(spiny);
		network.AddBool(isServe);
		network.AddBool(isBallInGame);
		network.AddBool(useNormalTime);
		network.AddInt(pingTimeMs);
		network.AddFloat(airResistance);
		network.AddFloat(rebound);
		network.AddFloat(racketTimeScale);
		network.EndWrite();
		network.Send(true, 0);
	}

	public void Deserialize(GGNetwork network)
	{
		ballPosition = network.GetVector3();
		landingPosition = network.GetVector3();
		heightAboveNet = network.GetFloat();
		timeToLand = network.GetFloat();
		spinx = network.GetFloat();
		spiny = network.GetFloat();
		isServe = network.GetBool();
		isBallInGame = network.GetBool();
		useNormalTime = network.GetBool();
		pingTimeMs = network.GetInt();
		airResistance = network.GetFloat();
		rebound = network.GetFloat();
		racketTimeScale = network.GetFloat();
	}
}
